﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using CIT.WMS.Product.Bll;

namespace CIT.WMS.Other
{
    public partial class FrmASELabelCheck : Form
    {
        public FrmASELabelCheck()
        {
            InitializeComponent();
        }

        private void FrmASELabelCheck_Load(object sender, EventArgs e)
        {
            txt_BoxNo.Focus();
        }

        /// <summary>
        /// 箱号
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void txt_BoxNo_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar != 13)
            {
                return;
            }

            if (string.IsNullOrEmpty(txt_BoxNo.Text))
            {
                MessageBox.Show("箱号不能为空!");
                txt_BoxNo.Focus();
                return;
            }
            lab_msg.Text = "箱号:" + txt_BoxNo.Text;
            txt_ConfirmBoxNo.Text = "";
            txt_ConfirmBoxNo.Focus();
        }

        /// <summary>
        /// 确认箱号
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void txt_ConfirmBoxNo_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar != 13)
            {
                return;
            }

            if (string.IsNullOrEmpty(txt_BoxNo.Text))
            {
                MessageBox.Show("箱号不能为空!");
                txt_BoxNo.Focus();
                return;
            }

            if (string.IsNullOrEmpty(txt_ConfirmBoxNo.Text))
            {
                MessageBox.Show("确认箱号不能为空!");
                txt_ConfirmBoxNo.Focus();
                return;
            }

            lab_msg.Text = "箱号:" + txt_BoxNo.Text;
            lab_msg.Text += "\r\n确认箱号:" + txt_ConfirmBoxNo.Text;

            if (!string.Equals(txt_BoxNo.Text, txt_ConfirmBoxNo.Text)) {
                MessageBox.Show("箱号不一致!");
                txt_ConfirmBoxNo.Text = "";
                txt_ConfirmBoxNo.Focus();
                return;
            }

            lab_msg.Text += "\r\n\r\n箱号一致!";
            txt_ConfirmBoxNo.Text = "";
            txt_BoxNo.Text = "";
            txt_BoxNo.Focus();
        }
    }
}